<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>LCOV - Lua 5.2.4 - src/ltm.c</title>
  <link rel="stylesheet" type="text/css" href="../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="35%" class="headerValue"><a href="../index.html">top level</a> - <a href="index.html">src</a> - ltm.c</td>
            <td width="5%"></td>
            <td width="15%"></td>
            <td width="10%" class="headerCovTableHead">Hit</td>
            <td width="10%" class="headerCovTableHead">Total</td>
            <td width="15%" class="headerCovTableHead">Coverage</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">Lua 5.2.4</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntry">22</td>
            <td class="headerCovTableEntry">22</td>
            <td class="headerCovTableEntryHi">100.0 %</td>
          </tr>
          <tr>
            <td class="headerItem">Date:</td>
            <td class="headerValue">2019-06-13 19:44:16</td>
            <td></td>
          </tr>
          <tr>
            <td class="headerItem">Legend:</td>
            <td class="headerValueLeg">            Lines:
            <span class="coverLegendCov">hit</span>
            <span class="coverLegendNoCov">not hit</span>
</td>
            <td></td>
          </tr>
          <tr><td><img src="../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>

    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td>
<pre class="sourceHeading">          Line data    Source code</pre>
<pre class="source">
<span class="lineNum">       1 </span>            : /*
<span class="lineNum">       2 </span>            : ** $Id: ltm.c,v 2.14.1.1 2013/04/12 18:48:47 roberto Exp $
<span class="lineNum">       3 </span>            : ** Tag methods
<span class="lineNum">       4 </span>            : ** See Copyright Notice in lua.h
<span class="lineNum">       5 </span>            : */
<span class="lineNum">       6 </span>            : 
<span class="lineNum">       7 </span>            : 
<span class="lineNum">       8 </span>            : #include &lt;string.h&gt;
<span class="lineNum">       9 </span>            : 
<span class="lineNum">      10 </span>            : #define ltm_c
<span class="lineNum">      11 </span>            : #define LUA_CORE
<span class="lineNum">      12 </span>            : 
<span class="lineNum">      13 </span>            : #include &quot;lua.h&quot;
<span class="lineNum">      14 </span>            : 
<span class="lineNum">      15 </span>            : #include &quot;lobject.h&quot;
<span class="lineNum">      16 </span>            : #include &quot;lstate.h&quot;
<span class="lineNum">      17 </span>            : #include &quot;lstring.h&quot;
<span class="lineNum">      18 </span>            : #include &quot;ltable.h&quot;
<span class="lineNum">      19 </span>            : #include &quot;ltm.h&quot;
<span class="lineNum">      20 </span>            : 
<span class="lineNum">      21 </span>            : 
<span class="lineNum">      22 </span>            : static const char udatatypename[] = &quot;userdata&quot;;
<span class="lineNum">      23 </span>            : 
<span class="lineNum">      24 </span>            : LUAI_DDEF const char *const luaT_typenames_[LUA_TOTALTAGS] = {
<span class="lineNum">      25 </span>            :   &quot;no value&quot;,
<span class="lineNum">      26 </span>            :   &quot;nil&quot;, &quot;boolean&quot;, udatatypename, &quot;number&quot;,
<span class="lineNum">      27 </span>            :   &quot;string&quot;, &quot;table&quot;, &quot;function&quot;, udatatypename, &quot;thread&quot;,
<span class="lineNum">      28 </span>            :   &quot;proto&quot;, &quot;upval&quot;  /* these last two cases are used for tests only */
<span class="lineNum">      29 </span>            : };
<span class="lineNum">      30 </span>            : 
<span class="lineNum">      31 </span>            : 
<span class="lineNum">      32 </span><span class="lineCov">        108 : void luaT_init (lua_State *L) {</span>
<span class="lineNum">      33 </span>            :   static const char *const luaT_eventname[] = {  /* ORDER TM */
<span class="lineNum">      34 </span>            :     &quot;__index&quot;, &quot;__newindex&quot;,
<span class="lineNum">      35 </span>            :     &quot;__gc&quot;, &quot;__mode&quot;, &quot;__len&quot;, &quot;__eq&quot;,
<span class="lineNum">      36 </span>            :     &quot;__add&quot;, &quot;__sub&quot;, &quot;__mul&quot;, &quot;__div&quot;, &quot;__mod&quot;,
<span class="lineNum">      37 </span>            :     &quot;__pow&quot;, &quot;__unm&quot;, &quot;__lt&quot;, &quot;__le&quot;,
<span class="lineNum">      38 </span>            :     &quot;__concat&quot;, &quot;__call&quot;
<span class="lineNum">      39 </span>            :   };
<span class="lineNum">      40 </span>            :   int i;
<span class="lineNum">      41 </span><span class="lineCov">       1944 :   for (i=0; i&lt;TM_N; i++) {</span>
<span class="lineNum">      42 </span><span class="lineCov">       1836 :     G(L)-&gt;tmname[i] = luaS_new(L, luaT_eventname[i]);</span>
<span class="lineNum">      43 </span><span class="lineCov">       1836 :     luaS_fix(G(L)-&gt;tmname[i]);  /* never collect these names */</span>
<span class="lineNum">      44 </span>            :   }
<span class="lineNum">      45 </span><span class="lineCov">        108 : }</span>
<span class="lineNum">      46 </span>            : 
<span class="lineNum">      47 </span>            : 
<span class="lineNum">      48 </span>            : /*
<span class="lineNum">      49 </span>            : ** function to be used with macro &quot;fasttm&quot;: optimized for absence of
<span class="lineNum">      50 </span>            : ** tag methods
<span class="lineNum">      51 </span>            : */
<span class="lineNum">      52 </span><span class="lineCov">        717 : const TValue *luaT_gettm (Table *events, TMS event, TString *ename) {</span>
<span class="lineNum">      53 </span><span class="lineCov">        717 :   const TValue *tm = luaH_getstr(events, ename);</span>
<span class="lineNum">      54 </span>            :   lua_assert(event &lt;= TM_EQ);
<span class="lineNum">      55 </span><span class="lineCov">        717 :   if (ttisnil(tm)) {  /* no tag method? */</span>
<span class="lineNum">      56 </span><span class="lineCov">        195 :     events-&gt;flags |= cast_byte(1u&lt;&lt;event);  /* cache this fact */</span>
<span class="lineNum">      57 </span><span class="lineCov">        195 :     return NULL;</span>
<span class="lineNum">      58 </span>            :   }
<span class="lineNum">      59 </span><span class="lineCov">        522 :   else return tm;</span>
<span class="lineNum">      60 </span>            : }
<span class="lineNum">      61 </span>            : 
<span class="lineNum">      62 </span>            : 
<span class="lineNum">      63 </span><span class="lineCov">       8062 : const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) {</span>
<span class="lineNum">      64 </span>            :   Table *mt;
<span class="lineNum">      65 </span><span class="lineCov">       8062 :   switch (ttypenv(o)) {</span>
<span class="lineNum">      66 </span><span class="lineCov">        153 :     case LUA_TTABLE:</span>
<span class="lineNum">      67 </span><span class="lineCov">        153 :       mt = hvalue(o)-&gt;metatable;</span>
<span class="lineNum">      68 </span><span class="lineCov">        153 :       break;</span>
<span class="lineNum">      69 </span><span class="lineCov">        635 :     case LUA_TUSERDATA:</span>
<span class="lineNum">      70 </span><span class="lineCov">        635 :       mt = uvalue(o)-&gt;metatable;</span>
<span class="lineNum">      71 </span><span class="lineCov">        635 :       break;</span>
<span class="lineNum">      72 </span><span class="lineCov">       7274 :     default:</span>
<span class="lineNum">      73 </span><span class="lineCov">       7274 :       mt = G(L)-&gt;mt[ttypenv(o)];</span>
<span class="lineNum">      74 </span>            :   }
<span class="lineNum">      75 </span><span class="lineCov">       8062 :   return (mt ? luaH_getstr(mt, G(L)-&gt;tmname[event]) : luaO_nilobject);</span>
<span class="lineNum">      76 </span>            : }
<span class="lineNum">      77 </span>            : 
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
    <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.13</a></td></tr>
  </table>
  <br>

</body>
</html>
